www.gusucode.com > 24Beta 虚拟主机版 1.0.0 Beta源码程序 > 24Beta 虚拟主机版 1.0.0 Beta源码程序/24Beta-1.0.0-vhost/protected/config/main.php

    <?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.

$dbConfig = require(dirname(__FILE__) . DS . 'dbconfig.php');
$params = require(dirname(__FILE__) . DS . 'params.php');

return array(
    'id' => '24beta.com',
	'basePath' => dirname(__FILE__) . DS . '..',
	'name' => $params['sitename'],
    'charset' => $params['charset'],
    'language' => $params['language'],
    'defaultController' => 'default',
    'layout' => 'main',
    'theme' => $params['theme'],
    

	// preloading 'log' component
	'preload' => array('log'),

	// autoloading model and component classes
	'import' => array(
		'application.models.*',
		'application.components.*',
        'application.extensions.*',
	),
	
	'modules' => array(
    	'admin' => array(
    	    'layout' => 'main',
    	),
    ),
    
	// application components
	'components' => array(
		'log' => array(
			'class' => 'CLogRouter',
			'routes' => array(
				array(
					'class' => 'CFileLogRoute',
					'levels' => 'error, warning, watch',
				    'categories' => 'system.*',
				),
				/*array(
					'class'=>'CWebLogRoute',
					'levels'=>'trace, info, error, warning',
					'categories' => 'system.db.*',
				),*/
			),
		),
		'user' => array(
			// enable cookie-based authentication
			'allowAutoLogin' => true,
		    'guestName' => $params['guest'],
		),
		// uncomment the following to set up database
		
		'db' => array(
		    'class' => 'CDbConnection',
			'connectionString' => $dbConfig['connectionString'],
		    'username' => $dbConfig['username'],
		    'password' => $dbConfig['password'],
		    'charset' => $dbConfig['charset'],
		    'persistent' => $dbConfig['persistent'],
		    'schemaCachingDuration' => 3600,    // metadata 缓存超时时间(s)
		),
		
		'authManager' => array(
		    'class' => 'CDbAuthManager',
            'connectionID' => 'db',
		    'defaultRoles' => array('guest'),
		),
		
		'assetManager' => array(
		    'basePath' => dirname(__FILE__) . '/../../resource/assets',
		    'baseUrl' => $params['baseUrl'] . 'resource/assets',
		),
		
		'themeManager' => array(
		    'basePath' => dirname(__FILE__) . '/../../themes',
		    'baseUrl' => $params['baseUrl'] . 'resource/themes',
		),
		
		/*
		 * 大数据使用的内存方式
		 */
		'cache' => (!$params['caching']) ? null : array(
		    'class' => 'CFileCache',
		    'directoryLevel' => 2,
		),
		
		/*
		 * 小数据始终使用文件缓存
		 */
		'fileCache' => array(
		    'class' => 'CFileCache',
		    'directoryLevel' => 1,
		),
		
		'urlManager' => array(
            'urlFormat' => $params['urlFormat'],
		    'showScriptName' => false,
		    'urlSuffix' => '.html',
            'rules' => array(
                'index-p<page:\d+>' => 'default/index',
		        'index' => 'default/index',
		        'html/list-<category:\d+>-<page:\d+>' => 'post/list',
		        'html/list-<category:\d+>' => 'post/list',
		        'html/topic-<tid:\d+>-p<page:\d+>' => 'topic/posts',
		        'html/topic-<tid:\d+>' => 'topic/posts',
		        'html/article-<aid:\d+>' => 'post/show',
		        'html/topics-<type:\w+>' => 'topic/list',
		        'static/<view:\w+>' => 'static/pages',
		        'm/article-<aid:\d+>' => 'm/show',
				'm/comments-<aid:\d+>' => 'm/comment',
            ),
        ),
		
		'session' => array(
        ),
        
        'request' => array(
        ),
		
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params' => $params,
);